LIN combo capture module ++++++++++++++++++++++++++ Initial steps ================ Before configurating the Capture module, some initial steps should be conducted: 1. **ID device check:** A rotary switch is located on the left-most part of the front side of the CM LIN Combo. This element allows the configuration of the IP address. The user should check the position of the rotary switch to ip of the device. From the IP we can detect the device ID: corresponds to the last byte of the IP address of the Capture module. .. note:: Each hardware variant of the Capture Modules is assigned a specific IP address range. For the Capture module LIN Combo variant, the following IP addresses will be configured: * Rotary switch on 0 -> IP: 10.104.3.48 * Rotary switch on 1 -> IP: 10.104.3.49 * Rotary switch on 2 -> IP: 10.104.3.50 * Rotary switch on E -> IP: 10.104.3.62 * Rotary switch on F -> IP: 10.104.3.73 / Reset .. thumbnail:: ../../static/images/rotary_switch.png :width: 600px :height: 212px 2. **IP address check:** As part of the verification, the user needs to check whether the IP address of the Ethernet adapter connected to the Capture module is within the same range as the Capture module's IP address. The first three bytes should belong to the same range. In this case, we are referring to **10.104.**. However, the last number in the Ethernet IP address, which is **210**, is different from the last number in the Capture module's IP address, which is **48** as it is mentioned in this case. .. thumbnail:: ../../static/images/Lin_Internet_protocol_version_properties.png :width: 476px :height: 552px 3. **Capture module check:** The user must perform a ping command to verify whether the device is reachable. .. thumbnail:: ../../static/images/Lin_CM_check.png :width: 717px :height: 278px 4. **Platform access:** Once the user ensures that the Capture module device is reachable, he (she) can access its web page. From there, he (she) retrieves the relevant system information that needs to be verified, including the latest firmware version and the license. .. thumbnail:: ../../static/images/Lin_Platform_access.png :width: 1071px :height: 567px After completing the initial validation steps of the Capture Module device, the user can proceed with setting up the channels. This tutorial provides a clear explanation of how to configure a channel using the LIN protocol. Configuring the first LIN Channel ------------------------------------------ The user can configure their first LIN channel by following these steps: 1. Click on “status” on the Capture module web page. 2. Click on the first channel, for example: **LIN-A**. .. note:: Not all LIN channels have the same capabilities. Channels such as **LIN(A-C-E-G-I)** support transmission, while others like **LIN(B-D-F-H-J)** are intended for logging only (spy mode). .. thumbnail:: ../../static/images/Configurating_LIN-A.png :width: 872px :height: 277px In the following web page window, several parameters can be specified: * **The output port:** The supported adapter through which the Capture Module transmits data traffic, for example the **100base T1 and GB-A(RJ45)**. * **The interface ID:** The logical ID assigned to the channel, such as 48A. * **The LIN Version:** The two LIN protocol versions supported by the Capture Module: **LIN V2.0 and LIN V1.3**. * **The LIN Mode:** The Capture module functions in different operational modes which are the following: Master, Slave and Spy. .. note:: The **LIN(B-D-F-H-J)** channels can only be configured in Spy mode. * **The LIN Bit rate:** The speed of data transmission over the LIN bus, set to **19200 bps** in this case. Configuring the Capture module port ------------------------------------------ To configure the Capture Module's communication port, the user can click on **“GB-A”** in the same status window on the web page. .. thumbnail:: ../../static/images/CM_Port_Configuration.png :width: 861px :height: 523px In this window, the user can detect the channels that the Capture module is loggin on, and he (she) has the ability to enable the configuration, status and control message ports. Moreover, he (she) can also “forward” the frame to the **100base-t1**. At the end, the most important parameter to be checked in this window is the **802.1as mode**. It indicates the **PTP sync mode**: * If the node is a **Slave**, another node will sync the capture module device that we are working on. * If the node is a **grandmaster**, the capture module device that we are working on will sync other devices. LIN communication protocol ----------------------------- The LIN protocol is based on a **Master-Slave architecture**. Communication relies on the presence of the Master node without it, no communication can take place. .. thumbnail:: ../../static/images/Master_Slave_architecture.png :width: 846px :height: 697px Configure Yaml file for MTF LIN ---------------------------------- After verifying the web page configuration, this tutorial will use an example test bench that includes a single Capture Module with ID 48. Channel A is connected to channel C, with channel A configured as Master and channel C as Slave. We will then prepare the YAML file accordingly. .. thumbnail:: ../../static/images/Conf_YAML_file_for_MTF_LIN.png :width: 873px :height: 287px LIN YAML Configuration ^^^^^^^^^^^^^^^^^^^^^^^^^ In the following section, we present the corresponding LIN YAML configuration, showing channels A and C and their mappings. .. thumbnail:: ../../static/images/LIN_Yaml_Configuration.png :width: 769px :height: 467px LIN Test Case ^^^^^^^^^^^^^^^^^^ .. code-block:: python from test_base import TestBase from time import sleep from xtr import logging, Severity logger = logging.getLogger(__name__) from mtf.enum_types import BusType from mtf.network_port.bus_transmitter import LinTransmitter as lin_transmitter from mtf.enum_types import BusType, FrameDirection # Create the test case class, that inherits from the preset TestBase class. class TestCaptureLinFrame(TestBase): # Create setUp() method. def setUp(self): logger.info("Setup test case") # Create the tearDown() method. def tearDown(self): logger.info("Tear down test case") # Create the test case method that holds the main test steps. def test_capture_LIN_frame(self): """ Test the transmission of a LIN frame and then verify that it was received correctly by checking the listener's queue. """ #start listening on LIN_48_C self.bus_manager.bus_listener("LIN_48_C",BusType.LIN).start_listening() #start transmitting from the channel LIN_48_A #using the frame id 0x20 lin_transmitter.transmit_frame(channel_name="LIN_48_A", frame_id=0x20, payload=[0x1,0x2,0x3,0x4,0x5,0x6,0x7]) sleep(1) #stop the listener on LIN_48_C self.bus_manager.bus_listener("LIN_48_C",BusType.LIN).stop_listening() #get the queue of the lin frames #received on the channel LIN_48_C queue_list = self.bus_manager.bus_listener("LIN_48_C",BusType.LIN).get_queue() #Verify that we received the lin frame that was sent self.assertTrue(queue_list.qsize() == 1, Severity.BLOCKER, "LIN Frame is not received") #verify for each message in the queue the frame_id, the payload, the channel_name and the direction for message in queue_list.queue: self.assertTrue( message.frame_id == 0x20, Severity.BLOCKER, "Check the frame_id of the LIN message on LIN_48_C") self.assertTrue( message.payload == [0x1,0x2,0x3,0x4,0x5,0x6,0x7], Severity.BLOCKER, "Check the payload of the LIN message on LIN_48_C") self.assertTrue( message.channel_name == "LIN_48_C", Severity.BLOCKER, "Check the channel name of the LIN message on LIN_48_C") self.assertTrue( message.direction.Rx == FrameDirection.Rx, Severity.BLOCKER, "Check the direction of the LIN message on LIN_48_C")